/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.cardarus.operatingsystem.domain;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;

/**
 * This class represents the registration of REMIND plan.
 * Customer register a REMIND plan for some reminders.
 *
 * @author Javier Snaider
 */
@Entity
public class ReminderRegistration implements Serializable {

    /**
     * The id of the registering reminder
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private int id;

    /**
     * The Customer associated with this registering reminder.
     */
    @OneToOne(mappedBy = "reminderRegistration")
    private Customer customer;

    /**
     * The date of registration of the reminder.
     */
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date registrationDate;

    /**
     * The max number of registering reminders.
     */
    private int maxReminders;

    /**
     * @return registering reminder id
     */
    public int getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(int id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) getId();
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ReminderRegistration)) {
            return false;
        }
        ReminderRegistration other = (ReminderRegistration) object;
        if (this.getId() != other.getId()) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.cardarus.operatingsystem.domain.ReminderRegistration[id=" + getId() + "]";
    }

    /**
     * @return the customer
     */
    public Customer getCustomer() {
        return customer;
    }

    /**
     * @param customer the customer to set
     */
    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    /**
     * @return the registrationDate
     */
    public Date getRegistrationDate() {
        return registrationDate;
    }

    /**
     * @param registrationDate the registrationDate to set
     */
    public void setRegistrationDate(Date registrationDate) {
        this.registrationDate = registrationDate;
    }

    /**
     * @return the maxReminders
     */
    public int getMaxReminders() {
        return maxReminders;
    }

    /**
     * @param maxReminders the maxReminders to set
     */
    public void setMaxReminders(int maxReminders) {
        this.maxReminders = maxReminders;
    }

}
